import Vue from 'vue'
import axios from 'axios'
import Cookies from 'js-cookie'

import 'normalize.css/normalize.css' // a modern alternative to CSS resets

import Element from 'element-ui'
import './styles/element-variables.scss'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log
import astrict from './utils/astrict'

import * as filters from './filters' // global filters
import qs from 'qs'
import VueCookies from 'vue-cookies'

import VideoPlayer from 'vue-video-player'
Vue.use(VideoPlayer)
require('vue-video-player/src/custom-theme.css')

Vue.use(VueCookies)
Vue.use(astrict)
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
// if (process.env.NODE_ENV === 'production') {
//   const {
//     mockXHR
//   } = require('../mock')
//   mockXHR()
// }
Cookies
Vue.use(Element, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
  // locale: enLang // 如果使用中文，无需设置，请删除
})

// register global utility filters
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.productionTip = false
Vue.prototype.$qs = qs
axios.defaults.timeout = 5000
axios.defaults.baseURL = 'http://testadmin-api.xunyinjiaoyou.com' // 测试2接口
// axios.defaults.baseURL = 'http://admin-api.xunyinjiaoyou.com' // zs接口
window.onload = function() {
  window.document.onmousedown = function() {
    localStorage.setItem('lastTime', new Date().getTime())
  }
}

/* 定时器 间隔30秒检测是否长时间未操作页面 */
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
